package com.jinsi.controller.tang;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jinsi.constant.YltConstant;
import com.jinsi.pojo.Examine;
import com.jinsi.service.tang.AuditLogService;
import com.jinsi.util.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 商品审核日志列表
 * @author 唐文博
 * @Date 2022-08-20
 */
@RestController
@RequestMapping("/auditLog")
public class AuditLogController {
    @Autowired
    private AuditLogService auditLogService;

    /**
     * 查看表，全查，分页
     * @param page
     * @param limit
     * @param commodityName
     * @param examinePersonnel
     * @param examineDate
     * @return
     */
    @RequestMapping("/getAuditLog")
    public R getAuditLog(Integer page,Integer limit,String commodityName,
                                           String examinePersonnel, String examineDate) {
        PageHelper.startPage(page, limit);
        List<Examine> list = auditLogService.getAuditLog(commodityName,examinePersonnel,examineDate);
        PageInfo<Examine> pageInfo = new PageInfo<>(list);
        return R.custom(YltConstant.LAYUI_CODE,
                YltConstant.LAYUI_MSG,
                pageInfo.getList(),
                pageInfo.getTotal());
    }
}
